package org.jeelk.sys.user.controller;

import org.jeelk.sys.user.model.User;
import org.jeelk.sys.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/user")
public class UserController {

	@Autowired
	private UserService userService;

	@RequestMapping(value = "loginImpl", method = RequestMethod.POST)
	public String loginImpl(Model model, User user) {
		System.out.println(">>>>>>>>>>>>>>.");
		return "view/system/home/index";
	}

	@RequestMapping(value = "login")
	public String login(Model model) {
		User u = userService.selectByPrimaryKey("1");
		model.addAttribute("user", u);
		return "view/system/user/login";
	}

}
